using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace HengTong.Model.Db.SupplyChain.Purchase;

/// <summary>
/// 采购申请单
/// </summary>
/// <remarks>
/// 用于记录采购申请的主要信息，支持多种采购场景：
/// <list type="bullet">
/// <item><description>常规采购：日常物料采购</description></item>
/// <item><description>备用采购：备品备件采购</description></item>
/// <item><description>设备新增：新增设备采购</description></item>
/// <item><description>安全新增：安全设施采购</description></item>
/// <item><description>紧急采购：紧急情况下的快速采购</description></item>
/// </list>
/// </remarks>
[Display(Name = "采购申请单", Description = "记录采购申请的主要信息", GroupName = "供应链")]
public class SysPurchaseRequestBill : BaseBill
{
    #region 基本信息

    /// <summary>
    /// 获取或设置申请人
    /// </summary>
    /// <value>采购申请的发起人姓名</value>
    [Display(Name = "申请人", Description = "采购申请的发起人姓名", GroupName = "基本信息")]
    [StringLength(64)]
    public string Applicant { get; set; }
    
    /// <summary>
    /// 获取或设置申请日期
    /// </summary>
    /// <value>采购申请单的提交日期</value>
    [Display(Name = "申请日期", Description = "采购申请单的提交日期", GroupName = "基本信息")]
    public DateTime? RequestDate { get; set; }
    
    /// <summary>
    /// 获取或设置需求日期
    /// </summary>
    /// <value>物料的期望到货日期</value>
    [Display(Name = "需求日期", Description = "物料的期望到货日期", GroupName = "基本信息")]
    public DateTime? NeedDate { get; set; }
    
    #endregion

    #region 采购信息

    /// <summary>
    /// 获取或设置采购类型
    /// </summary>
    /// <value>采购类型：常规、备用、设备新增、安全新增等</value>
    [Display(Name = "采购类型", Description = "采购类型：常规、备用、设备新增、安全新增等", GroupName = "采购信息")]
    public PurchaseType? PurchaseType { get; set; }
    
    /// <summary>
    /// 获取或设置物料类型
    /// </summary>
    /// <value>采购物料的分类</value>
    [Display(Name = "物料类型", Description = "采购物料的分类", GroupName = "采购信息")]
    public MaterialType? MaterialType { get; set; }
    
    #endregion

    #region 紧急信息

    /// <summary>
    /// 获取或设置紧急程度
    /// </summary>
    /// <value>采购的紧急程度：一般、紧急</value>
    [Display(Name = "紧急程度", Description = "采购的紧急程度：一般、紧急", GroupName = "紧急信息")]
    public UrgencyLevel? UrgencyLevel { get; set; }
    
    /// <summary>
    /// 获取或设置紧急采购原因
    /// </summary>
    /// <value>紧急采购的详细说明和理由，最多1024个字符</value>
    [Display(Name = "紧急采购原因", Description = "紧急采购的详细说明和理由", GroupName = "紧急信息")]
    [StringLength(1024, ErrorMessage = "紧急采购原因不能超过1024个字符")]
    public string UrgencyReason { get; set; }
    
    #endregion

    #region 金额信息

    /// <summary>
    /// 获取或设置总金额
    /// </summary>
    /// <value>采购申请单的总金额，精度为6位小数</value>
    [Display(Name = "总金额", Description = "采购申请单的总金额", GroupName = "金额信息")]
    [Column(TypeName = "decimal(18,6)")]
    public decimal? Amount { get; set; }
    
    #endregion

    #region 附件信息

    /// <summary>
    /// 获取或设置附件列表
    /// </summary>
    /// <value>采购申请单关联的附件文件集合</value>
    [Display(Name = "附件", Description = "采购申请单关联的附件文件", GroupName = "附件信息")]
    public List<SysPurchaseRequestBillFile> Files { get; set; }

    #endregion
}

/// <summary>
/// 采购类型枚举
/// </summary>
/// <remarks>
/// 定义不同的采购场景类型
/// </remarks>
public enum PurchaseType
{
    /// <summary>
    /// 常规: 常规采购
    /// </summary>
    [Display(Name = "常规")]
    常规,
    
    /// <summary>
    /// 设备新增：新增设备采购
    /// </summary>
    [Display(Name = "设备新增")]
    设备新增,
    
    /// <summary>
    /// 安全新增：安全设施采购
    /// </summary>
    [Display(Name = "安全新增")]
    安全新增,
    
    /// <summary>
    /// 其他：其他类型采购
    /// </summary>
    [Display(Name = "其他")]
    其他 = 99
}

/// <summary>
/// 物料类型枚举
/// </summary>
/// <remarks>
/// 定义采购物料的分类
/// </remarks>
public enum MaterialType
{
    /// <summary>
    /// 备品备件：设备维护用备品备件
    /// </summary>
    [Display(Name = "备品备件")]
    备品备件,
    
    /// <summary>
    /// 化工小料：化工生产用小料
    /// </summary>
    [Display(Name = "化工小料")]
    化工小料,
    
    /// <summary>
    /// 大宗原材料：大宗原材料采购
    /// </summary>
    [Display(Name = "大宗原材料")]
    大宗原材料
}

/// <summary>
/// 紧急程度枚举
/// </summary>
/// <remarks>
/// 定义采购的紧急程度级别
/// </remarks>
public enum UrgencyLevel
{
    /// <summary>
    /// 一般：常规采购，无特殊时效要求
    /// </summary>
    [Display(Name = "一般")]
    一般,
    
    /// <summary>
    /// 紧急：紧急采购，需要加快处理
    /// </summary>
    [Display(Name = "紧急")]
    紧急
}

